package com.abing.starry.model.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Author CaptainBing
 * @Date 2024/9/18 9:58
 * @Description
 */
@Getter
@AllArgsConstructor
public enum QuestionSubmitStatusEnum {

    SUCCESS("ok",0),
    COMPILE_FAILED("编译错误",1),
    RUNNING_FAILED("运行错误",2),
    OUTPUT_OF_LIMIT("输出超限",3),
    MEMORY_OF_LIMIT("内存超限",4),
    TIME_OUT("时间超限",5),
    ANSWER_INCORRECT("答案错误",6),
    FORMAT_INCORRECT("格式错误",7);

    private final String text;
    private final Integer value;

    /**
     * 根据value获取枚举
     * @param value
     * @return
     */
    public static QuestionSubmitStatusEnum of(Integer value) {

        for (QuestionSubmitStatusEnum questionSubmitStatusEnum : QuestionSubmitStatusEnum.values()) {
            if (questionSubmitStatusEnum.getValue().equals(value)) {
                return questionSubmitStatusEnum;
            }
        }
        return null;
    }


}
